﻿using System;
using System.Collections.Generic;

namespace UniRx
{
	// Token: 0x02000423 RID: 1059
	public static class ReactivePropertyExtensions
	{
		// Token: 0x060015FD RID: 5629 RVA: 0x0006032C File Offset: 0x0005E72C
		public static ReactiveProperty<T> ToReactiveProperty<T>(this IObservable<T> source)
		{
			return new ReactiveProperty<T>(source);
		}

		// Token: 0x060015FE RID: 5630 RVA: 0x00060334 File Offset: 0x0005E734
		public static ReactiveProperty<T> ToReactiveProperty<T>(this IObservable<T> source, T initialValue)
		{
			return new ReactiveProperty<T>(source, initialValue);
		}

		// Token: 0x060015FF RID: 5631 RVA: 0x0006033D File Offset: 0x0005E73D
		public static ReadOnlyReactiveProperty<T> ToReadOnlyReactiveProperty<T>(this IObservable<T> source)
		{
			return new ReadOnlyReactiveProperty<T>(source);
		}

		// Token: 0x06001600 RID: 5632 RVA: 0x00060345 File Offset: 0x0005E745
		public static ReadOnlyReactiveProperty<T> ToSequentialReadOnlyReactiveProperty<T>(this IObservable<T> source)
		{
			return new ReadOnlyReactiveProperty<T>(source, false);
		}

		// Token: 0x06001601 RID: 5633 RVA: 0x0006034E File Offset: 0x0005E74E
		public static ReadOnlyReactiveProperty<T> ToReadOnlyReactiveProperty<T>(this IObservable<T> source, T initialValue)
		{
			return new ReadOnlyReactiveProperty<T>(source, initialValue);
		}

		// Token: 0x06001602 RID: 5634 RVA: 0x00060357 File Offset: 0x0005E757
		public static ReadOnlyReactiveProperty<T> ToSequentialReadOnlyReactiveProperty<T>(this IObservable<T> source, T initialValue)
		{
			return new ReadOnlyReactiveProperty<T>(source, initialValue, false);
		}

		// Token: 0x06001603 RID: 5635 RVA: 0x00060361 File Offset: 0x0005E761
		public static IObservable<T> SkipLatestValueOnSubscribe<T>(this IReadOnlyReactiveProperty<T> source)
		{
			return (!source.HasValue) ? source : source.Skip(1);
		}

		// Token: 0x06001604 RID: 5636 RVA: 0x0006037B File Offset: 0x0005E77B
		public static IObservable<bool> CombineLatestValuesAreAllTrue(this IEnumerable<IObservable<bool>> sources)
		{
			return sources.CombineLatest<bool>().Select(delegate(IList<bool> xs)
			{
				using (IEnumerator<bool> enumerator = xs.GetEnumerator())
				{
					while (enumerator.MoveNext())
					{
						if (!enumerator.Current)
						{
							return false;
						}
					}
				}
				return true;
			});
		}

		// Token: 0x06001605 RID: 5637 RVA: 0x000603A5 File Offset: 0x0005E7A5
		public static IObservable<bool> CombineLatestValuesAreAllFalse(this IEnumerable<IObservable<bool>> sources)
		{
			return sources.CombineLatest<bool>().Select(delegate(IList<bool> xs)
			{
				foreach (bool flag in xs)
				{
					if (flag)
					{
						return false;
					}
				}
				return true;
			});
		}
	}
}
